using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using System.Collections.Generic;

namespace SqlRunner.Readers
{
	/// <summary>
	/// Summary description for CSVReader.
	/// </summary>
	public class FileReader : IFolderReader
	{
		public FileReader(){}

		public List<string> ReadFolders(DragEventArgs e)
		{
			Trace.WriteLine("FileReader - Reading dragged object");
			List<string> folders = new List<string>();
			// Check the type is a filedrop
			if (e.Data.GetDataPresent(DataFormats.FileDrop))
			{
				string[] str = (string[])e.Data.GetData(DataFormats.FileDrop);
				for (int i = 0; i < str.Length; i++)
				{
					DirectoryInfo aDir = new DirectoryInfo(str[i]);
					if (aDir.Exists) 
						folders.Add(aDir.FullName);
					else
						Trace.WriteLine(String.Format("{0} could not found", str[i]));
				}
			}
			return folders;
		}
	}
}